<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title></title>
	<js file="__STATIC__/hdjs/jquery-1.7.2.min.js"/>
	<css file="__STATIC__/hdjs/hdjs.css"/>
	<js file="__STATIC__/hdjs/hdjs.min.js"/>
</head>
<body>
	
	<div class="hd-menu-list">
	    <ul>
	        <li class="active"><a href="#">标签列表</a></li>
	        <li><a href="{|U:'Tag/add'}">添加标签</a></li>
	        <li><a href="{|U:'Tag/cache'}">更新缓存</a></li>

	    </ul>
	</div>
	<form action="{|U:'tag/edit'}" method="post">
		<table class="hd-table hd-table-list">
		    <thead>
		    <tr>
		    	<td>选择</td>
		        <td>TID</td>
		        <td>标签名</td>
		        
		        <td>操作</td>
		    </tr>
		    </thead>
		    
		    <tbody>
		    	<list from="$tag" name="$t">
				    <tr>
				    	<td  class="hd-w30 tid"><input type="checkbox" name="tid[]" value="{$t.tid}"></td>
				        <td>{$t.tid}</td>
				        <td class="tname">
				            {$t.tname}
				        </td>
				        
				        <td class="hd-w100">
				            <a href="{|U:'Tag/del',array('tid'=>$t['tid'])}">删除</a> 
				            <!-- | -->
				            <!-- <a href="{|U:'Tag/add'}">添加</a> -->
				        </td>
				    </tr>
				</list>
		    </tbody>
		</table>
		<input type="submit" value="修改">
	</form>
	<script type="text/javascript">
		$(function(){
			$('.tid').click(function(){
				// alert('123');
				choose=$(this).attr('choose');
				if(!choose){
					$(this).attr('choose', '1');
					value =$(this).parents('tr').eq(0).find('.tname').html();
					value=value.trim();

					str="<input type='text' name='tname[]' value='"+value+"' />";
					$(this).parents('tr').eq(0).find('.tname').html(str);
				}else{
					$(this).removeAttr('chose');
					tname = $(this).parents('tr').eq(0).find('.tname').find('input').val();
					$(this).parents('tr').eq(0).find('.tname').html(tname);
				}
				
			})
		})
	</script>
</body>
</html>